package ekahau.positioning.services.providor.server;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;


public class ImageServer {
	public static void main(String[] args) 
	{
		int port = 8890;
		ServerSocket srv ;
		Socket socket ;
		try {
			srv = new ServerSocket(port);
			while(true)
			{	
				System.out.println("Waiting");
				socket = srv.accept();
				ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
				try {
					in.readObject() ;
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
					
				FileInputStream fis = new FileInputStream("C:\\Documents and Settings\\ssr\\Desktop\\Ekahau_Src_\\EkahauClient\\icons\\A1500_korridoren.jpg");
				byte[] buffer = new byte[fis.available()];
				fis.read(buffer);
				ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()) ;
				oos.writeObject(buffer);
				System.out.println("send");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}// Waiting for incoming connection
	}
}